package cn.itcast.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.itcast.pojo.OrderSetting;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderSettingVo implements Serializable {
    private Integer id ;
    private String date;//预约设置日期
    private int number;//可预约人数
    private int reservations ;//已预约人数

    public static OrderSettingVo init(OrderSetting orderSetting){
        OrderSettingVo vo = new OrderSettingVo();
        BeanUtil.copyProperties(orderSetting,vo);
        Date orderDate = orderSetting.getOrderDate();
        String day = DateUtil.format(orderDate, "dd");
        vo.setDate(day);
        return vo;
    }
}